package com.hengpeng.itfints.tags;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.hengpeng.common.util.StringHelper;

/**
 * <pre>
 * html特殊字符转义
 * </pre>
 * @author chenjian
 * @version 1.0, 2012-9-6
 */
public class HtmlEscapeTag extends TagSupport
{
	private static final long serialVersionUID = 5124608067823510870L;

	private String text;

	public String getText()
	{
		return text;
	}

	public void setText(String text)
	{
		this.text = text;
	}

	@Override
	public int doStartTag() throws JspException
	{
		super.doStartTag();
		try
		{
			pageContext.getOut().print(StringHelper.replace(text));
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return SKIP_BODY;
	}
}
